<?php

namespace App\Models\dispatch;

use App\Http\Controllers\Admin\Examine\Record;
use App\Models\AdminModel;
use App\Models\AgentModel;
use App\Models\examine\RecordDetailModel;
use App\Models\examine\RecordModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class PurchaseDetailModel extends BaseModel
{
    use HasFactory, SoftDeletes;

    protected $table = 't_dispatch_material_purchase';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];


    //创建人
    public function create_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'created_admin_id');
    }

    //物料
    public function material(): BelongsTo {
        return $this->belongsTo(MaterialModel::class, 'material_id');
    }


}
